package com.knowledge.review.designPatterns.creatormode.factorypattern.factorymethodpattern;

/**
 * @author XFW
 * @date 2024/5/6 14:00
 * @Description 具体测试类
 **/
public class Test {

    public static void main(String[] args) {

        FruitColorFactory colorFactory = new FruitColorFactory();
        FruitTasteFactory tasteFactory = new FruitTasteFactory();
        Fruit fruitColor = colorFactory.createFruit("Orange");
        Fruit fruitTaste = tasteFactory.createFruit("Orange");

        System.out.print(fruitColor.getColor());
        System.out.println(fruitTaste.getTaste());

        fruitColor = colorFactory.createFruit("Apple");
        fruitTaste = tasteFactory.createFruit("Apple");

        System.out.print(fruitColor.getColor());
        System.out.println(fruitTaste.getTaste());

        fruitColor = colorFactory.createFruit("Pear");
        fruitTaste = tasteFactory.createFruit("Pear");

        System.out.print(fruitColor.getColor());
        System.out.println(fruitTaste.getTaste());
    }
}